import java.time.LocalDate;
import java.util.ArrayList;
import java.util.List;

public class RegularUser {
    private String username;
    private String password;
    private String email;
    private String membershipLevel;
    private LocalDate registrationDate;
    private String phoneNumber;
    private double totalSpent;
    private List<String> shoppingHistory;

    // 修改构造函数以初始化购物历史列表
    public RegularUser(String username, String password, String email, String membershipLevel, String phoneNumber) {
        this.username = username;
        this.password = password;
        this.email = email;
        this.membershipLevel = membershipLevel;
        this.registrationDate = LocalDate.now(); // 默认注册日期为当前日期
        this.totalSpent = 0.0; // 默认总支出为0
        this.phoneNumber = phoneNumber;
        this.shoppingHistory = new ArrayList<>(); // 初始化购物记录
    }

    public String getUsername() {
        return username;
    }

    public String getPassword() {
        return password; // 添加获取密码的方法
    }

    public void setPassword(String password) {
        this.password = password; // 添加设置密码的方法
    }

    public String getEmail() {
        return email;
    }

    public List<String> getShoppingHistory() {
        return shoppingHistory; // 返回购物记录的方法
    }

    public void addToShoppingHistory(String record) {
        shoppingHistory.add(record); // 添加购物记录的方法
    }

    public String getMembershipLevel() {
        return membershipLevel;
    }

    public LocalDate getRegistrationDate() {
        return registrationDate;
    }

    public double getTotalSpent() {
        return totalSpent;
    }

    public String getPhoneNumber() {
        return phoneNumber;
    }

    // 方法用于增加总支出
    public void addToTotalSpent(double amount) {
        this.totalSpent += amount;
    }
}

